#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include <SceneGraph/dynamic_body.h>
#include <string>
using namespace PhysLeo;
namespace py = pybind11;

template<typename T>
static void declareDynamicBody(py::module &mod, const std::string &typestr)
{
    using class_type = DynamicBody<T>;
    auto pyclass_name = std::string("DynamicBody") + typestr;
    py::class_<class_type, Node, Animable, Renderable, std::shared_ptr<class_type>>cls(mod, pyclass_name.c_str());

    cls.def(py::init<std::shared_ptr<Integrator<T>>, std::string>());
    cls.def("addRender", &class_type::addRender);
    cls.def("getSimData", &class_type::getSimData);
    cls.def("__repr__", [](const DynamicBody<T> & a)
    {
        return std::string("DynamicBody(") + a.name() + ")";
    });
}

void initDynamicBody(py::module &m)
{
    declareDynamicBody<float>(m, std::string("F"));
    declareDynamicBody<double>(m, std::string("D"));
}
